#pragma once
#include "Polygon.h"
#include "Ball.h"
#include "Paddle.h"

class Collision
{
public:
	Collision(void);
	~Collision(void);

	inline void getInterval(CPolygon polygon, Vector Axis, float &min, float &max);
	inline void getInterval(CPolygon polygon, Vector Axis, float &min, float &max, Vector Vel, float &minv, float &maxv);
	inline bool isCollided(CPolygon A,CPolygon B, Vector &MTD);
	bool isCollided(CPolygon A, CPolygon B, Vector &MTD, Vector Vel, Vector &PushVelVector, bool &willCollide);
	bool isCollided(MovingObject* OA, GObject* OB);
	//Vector isCollided(MovingObject* OA, GObject* OB);
	inline bool axisSeperatePolygon(Vector Axis, CPolygon A, CPolygon B);
	//bool axisSeperatePolygon(Vector Axis, CPolygon A, CPolygon B, Vector &PushVector);
	inline bool axisSeperatePolygon(Vector Axis, CPolygon A, CPolygon B, Vector &PushVector, Vector Vel, float &Percent);
	inline int axisSeperatePolygon(Vector Axis,CPolygon A, CPolygon B, Vector &PushVector,Vector Vel, Vector* PushVelVector, int &numPushVelVector);

	inline Vector findMTD(Vector* PushVectorList,int numItem);
	inline Vector findPushVelVector(Vector *PushVelVectorList, int numItem);
	//inline Vector getVector(Vector Origin, Vector v);
	bool isCollided(MovingObject* OA, MovingObject* OB);
	bool isIntersect(RECT rect1, RECT rect2)
	{
		if (rect1.top > rect2.bottom || rect1.bottom < rect2.top || rect1.left > rect2.right || rect1.right < rect2.left)
			return false;
		else return true;
	}

};